<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>编辑经销商</title>
<%@include file="../include/include.jsp"%>
<link rel="stylesheet" type="text/css" href="${csspath }/public.css"/>
<link rel="stylesheet" type="text/css" href="${csspath }/datepicker.css"/>
<link rel="stylesheet" type="text/css" href="${csspath }/style_l.css"/>
<script type="text/javascript" src="${jspath }/jquery-1.4.4.js"></script>
<script type="text/javascript" src="${jspath }/jquery.ui.min.js"></script>
<script type="text/javascript" src="${jspath }/ui.datepicker_zh-CN.js"></script>
<script type="text/javascript" src="${jspath }/jquery.blockUI.js"></script>
<script type="text/javascript" src="${jspath }/public.js"></script>
<script type="text/javascript" src="${jspath }/jquery.selectAll.js"></script>
<script type="text/javascript" src="${jspath}/jquery/jquery.ui.draggable.js"></script>
<script type="text/javascript" src="${jspath}/jquery/jquery.alerts.js"></script>
<link rel="stylesheet" type="text/css" href="${csspath}/jquery.alerts.css" />
<script type="text/javascript" src="${jspath}/load_layer.js"></script>
<link rel="stylesheet" type="text/css"
	href="${webcontext}/css/validationEngine.jquery.css" />
<script src="${jspath}/jquery/validate/jquery.validationEngine.js"
	type="text/javascript"></script>
<script src="${jspath}/jquery/validate/jquery.validationEngine-zh.js"
	type="text/javascript"></script>
	<script type="text/javascript"
	src="${webcontext}/javascript/jquery/jquery.ui.draggable.js"></script>
<style type="text/css">
.formError .formErrorContent {
    -moz-border-radius: 6px 6px 6px 6px;
    -moz-box-shadow: 0 0 6px #000000;
    background: none repeat scroll 0 0 #EE0101;
    border: 2px solid #DDDDDD;
    color: #FFFFFF;
    font-family: tahoma;
    font-size: 11px;
    padding: 4px 10px;
    width: 100px;
}
</style>
<script type="text/javascript">


$(function(){
	
	
	$("#edit_dealer").validationEngine(
			{
             promptPosition:"topLeft",
             success:false,
             validationEventTriggers : "change blur",
			 failure:function(){} 
	});
	
	$("#save").click(function(){
		
		if(!$("#edit_dealer").validationEngine(
				{
	             promptPosition:"topLeft",
	             validationEventTriggers : "change blur",
	           	 returnIsValid:true
				 })){
			return;
		}
		
		jConfirm("确认保存此记录？","确认提示",function(result){
    		if(result == true)
    		{	
            	$("#edit_dealer").submit();
    		}
    	});
		
	});
	
	$("#saveAndSubmit").click(function(){
		
		if(!$("#edit_dealer").validationEngine(
				{
	             promptPosition:"topLeft",
	             validationEventTriggers : "change blur",
	           	 returnIsValid:true
				 })){
			return;
		}
		
		jConfirm("确认保存并提交此记录？","确认提示",function(result){
    		if(result == true)
    		{	
            	$("#edit_dealer").submit();
    		}
    	});
		
	});
    
});

function idCardValid(value){
	var strP=/^(\d{15}|(\d{17}[\dXx]))$/;
	if(strP.test(value)){
		return true;
	}else{
		return false;
	}
}

</script>

</head>
<body>

	<!-- content -->
	<div id="content">
		<!-- wrap -->
		<div id="wrap">
        <!-- breadcrumb -->
			<div id="breadcrumb">编辑经销商</div>

			<!-- /breadcrumb -->
			<!-- info_div -->
 <form:form id="edit_dealer" action="${webcontext}/crmdp/dealer/masterdata/saveOrUpdateDealer" method="post" modelAttribute="submitDto" enctype="multipart/form-data">

 <input type="hidden" id="operationType" name="operationType"/>
		  <div class="input_div">
				<div class="title">
					<p>基本资料</p>
				</div>
                <div>
                
				 <style>
                .input_tab { table-layout:fixed; }
                </style>
                <core:forEach items="${dealerResultsDtoList}" var="dealerResultsDto">
					<table class="input_tab">
		                    
	                     <tr>
							  <td colspan="6" class="spliterInput_Line">
							    <img src="${webcontext}/images/pictures_l/spliterInput_line_03.gif" width="550" height="9" />
							  </td>
							  <td>
							  		<input type="hidden" name="id" value="${dealerResultsDto.id}"/>
							  </td>
						 </tr>
	                      <tr>
		                      <td class="label" align="right"><span class="need">*</span>经销商编号：</td>
		                      <td align="left"><form:input path="dealerNum" cssClass="validate[required,length[6,6]] text string" value="${dealerResultsDto.dealerNum}" readonly="true"/></td>
		                      <td>&nbsp;</td>
		                      <td class="label" align="right"><span class="need">*</span>经销商名称：</td>
		                      <td align="left"><form:input path="dealerName" cssClass="validate[required,length[1,250]] text" cssStyle="width:300px;" value="${dealerResultsDto.dealerName}" readonly="true"/></td>
		                      <td class="label" align="right"></td>
		                      <td align="left"></td>
	                     </tr>
	                     <tr>
		                        <td class="label"><span class="need">*</span>经销商类型：</td>
		                       	<td> <form:select path="dealerProgram" cssClass="validate[required] sel">
			                       	 <form:option value="0" readonly="true">请选择</form:option>
							         	<%= CodeTextUtils.getOptions("MasterDataDealerInfo.DealerProgram","" ) %>
									 </form:select>  
								</td>
								<td>&nbsp;</td>
								<td class="label" align="left" cssStyle="width:100px;"><span class="need">*</span>经销商区域：</td>
		                       	<td> <form:select path="region" cssClass="validate[required] sel">
			                       	 <form:option value="0">请选择</form:option>
							         	<%= CodeTextUtils.getOptions("MasterDataDealerInfo.DealerRegion","" ) %>
									 </form:select>  
								</td>
								<td class="label" align="right"></td>
		                        <td align="left"></td>
	                     </tr>
	                     <tr>
	                     		<td class="label"><span class="need">*</span>经销商所属省：</td>
		                       	<td> <form:select path="province" cssClass="validate[required] sel">
			                       	 <form:option value="1">请选择</form:option>
							         	<option value="1">上海市</option>
									 </form:select>  
								</td>
								<td>&nbsp;</td>
	                     		<td class="label"><span class="need">*</span>经销商所属市：</td>
		                       	<td> <form:select path="city" cssClass="validate[required] sel">
			                       	 <form:option value="1">请选择</form:option>
									    <option value="1">上海市</option>
									 </form:select>  
								</td>
								 <td class="label" align="right"></td>
			                     <td align="left">
		                        </td>
	                     </tr>
	                     <tr>
		                       <td class="label"><p><span class="need">*</span>经销商地址：</p></td>
		                       <td colspan="3"><form:input path="address" cssClass="validate[required,length[0,250]] text" cssStyle="width:630px;" value="${dealerResultsDto.address}" readonly="true"/>
		                       
		                       </td>
								<td>&nbsp;</td>
	
		                       <td class="label" align="right"></td>
		                       <td align="left"></td>
	                     </tr>
	                     <tr>
		                       <td class="label"><p><span class="need">*</span>联系人姓名：</p></td>
	                           <td align="left"><form:input path="contactName" cssClass="validate[required,length[1,300]] text string" value="${dealerResultsDto.contactName}"/></td>
		                       <td class="label"><p><span class="need">*</span>联系人手机：</p></td>
		                       <td><form:input path="contactPhone" cssClass="validate[custom[mobilePhone]] text" value="${dealerResultsDto.contactPhone}"/></td>
		                       <td class="label"><span class="need">*</span>经销商状态：</td>
			                   <td><form:select path="dealerStatus" class="sel">  
							  	 		<form:option value="1">请选择</form:option>
						        			<%= CodeTextUtils.getOptions("MasterDataDealerInfo.DealerStatus","" ) %>
								    	</form:select>
							   </td>
	                     	   <td class="label" align="right"></td>
		                       <td align="left"></td>
	                     </tr>
					</table>
				</core:forEach>  
		    </div>
		  </div>
			<!-- /info_div -->
            
            <div class="spliter h_10"></div>           
             <div class="spliter h_5"></div>
            
            <div class="btn_div">
<!--                <input type="button" class="btn" id="save" value="保存"/>-->
                <input type="button" class="btn" id="saveAndSubmit" value="保存并提交"/>
                <input type="button" class="btn" value="取消" onclick="javascript:window.history.back();"/>
            </div>
             
      </form:form>  
      </div>
		<!-- /wrap -->
	</div>
	<!-- /content -->

  </body>

</html>